#include "ShowResultUdp.h"




void ShowResultUdp::showRes(string msg){

	cout<< "[info] process image result: "<<msg <<endl;    
    memset(buf,0,sizeof(buf));
    strcpy(buf, msg.c_str());
    sendto(udp_socket_fd, buf, strlen(buf), 0, (struct sockaddr *)&dest_addr,sizeof(dest_addr)); 
   
}

ShowResultUdp::ShowResultUdp(){
	udp_socket_fd = socket(AF_INET, SOCK_DGRAM, 0);
	if(udp_socket_fd == -1)
	{
		perror("socket failed!\n");
	}
	memset(&dest_addr,0,sizeof(dest_addr));
    dest_addr.sin_family = AF_INET;
    dest_addr.sin_port = htons(20000);
    dest_addr.sin_addr.s_addr = inet_addr("10.10.10.193"); 

    memset(buf,0,sizeof(buf));

}
ShowResultUdp::~ShowResultUdp(){
	 close(udp_socket_fd);

}
